const app = getApp();
const util = require('../../utils/util.js');
Page({
    data: {
        positionName: '',

    },
    onLoad: function () {
        wx.setNavigationBarTitle({
            title: '位置添加'
        })

    },
    bindPositionName(e) {
        this.setData({
            positionName: e.detail.value
        })
    },

    addPosition: util.throttle(function () {

        wx.showLoading({
            title: '加载中',
        });
        var that = this;
        wx.request({
            url: app.globalData.APIURL + '/vending-admin/admin/para/add',
            data: {
                token: app.globalData.token,
                value_desc: that.data.positionName,
                column:'ve_equipment.position'
            },
            // method:'GET',
            header: {
                'content-type': 'application/json' // 默认值
            },
            success: function (res) {
                console.log(res.data)
                wx.hideLoading();
                if (app.requestEro(res.data.success, res.data.msg)) {
                    wx.showModal({
                        title: '添加成功',
                        showCancel: false,
                        success: function (res) {
                            if (res.confirm) {
                                wx.navigateBack({
                                    delta: 1
                                })
                            }
                        }
                    });
                }
            },
            fail: function (err) {
                console.log(err)
            }
        })

    }, 1000),

})